<?php

use yii\db\Migration;

/**
 * Handles the creation of table `sys_menu_cate`.
 */
class m190124_083648_create_sys_menu_cate_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_menu_cate', [
            'id' => $this->primaryKey(),
            'name' => $this->string(32)->notNull()->defaultValue('')->comment('名称'),
            'icon' => $this->string(32)->notNull()->defaultValue('')->comment('图标icon'),
            'is_show' => $this->boolean()->notNull()->defaultValue(1)->comment('默认是否显示'),
            'sort' => $this->tinyInteger(4)->defaultValue(0)->comment('排序'),
            'status' => $this->tinyInteger(4)->notNull()->defaultValue(1)->comment('状态[-1:删除,0:禁用,1:启用]'),
            'created_at' => $this->integer()->notNull()->comment('创建时间'),
            'updated_at' => $this->integer()->notNull()->comment('更新时间'),
        ]);
        $this->insert('sys_menu_cate', [
            'name' => '平台首页',
            'icon' => 'bookmark',
            'is_show' => true,
            'sort' => 1,
            'status' => 1,
            'created_at' => time(),
            'updated_at' => time(),
        ]);
        $this->insert('sys_menu_cate', [
            'name' => '系统管理',
            'icon' => 'cogs',
            'is_show' => true,
            'sort' => 1,
            'status' => 1,
            'created_at' => time(),
            'updated_at' => time(),
        ]);
        $this->insert('sys_menu_cate', [
            'name' => '微信管理',
            'icon' => 'wechat',
            'is_show' => true,
            'sort' => 1,
            'status' => 1,
            'created_at' => time(),
            'updated_at' => time(),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_menu_cate');
    }
}
